﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace zielonka.co.uk.extensions.system
{
    /*
        Description:	new FileInfo("C:\image.jpg").Open();
     */

    public static partial class FileInfoExtensions
	{
        /// <summary>
        /// Open with default 'open' program
        /// </summary>
        /// <param name="value"></param>
        public static Process Open(this FileInfo value)
        {
            if (!value.Exists)
                throw new FileNotFoundException("File doesn't exist");
            Process p = new Process();
            p.StartInfo.FileName = value.FullName;
            p.StartInfo.Verb = "Open";
            p.Start();
            return p;
        }
	}
}
